
***MODELS FOR TABLE 1***


*Model 1 Random Effects, no interactions
xtlogit cgovtarget  econ_issue c.GovtShareGDP pol_issue c.polity2 ethnic_issue c.discpop protest strike  CIRIPhysInteg log_pop log_gdp capital auton africa if etype<7 & auton>=0, re
*Model 2 Random Effects, with interactions
xtlogit cgovtarget  econ_issue##c.GovtShareGDP pol_issue##c.polity2 ethnic_issue##c.discpop protest strike  CIRIPhysInteg log_pop log_gdp capital auton africa if etype<7 & auton>=0, re
*This model is for a footnote and it includes CIRI freedom of association*
xtlogit cgovtarget  econ_issue##c.GovtShareGDP pol_issue##c.polity2 ethnic_issue##c.discpop protest strike  CIRIFreedomAssn log_pop log_gdp capital auton africa if etype<7 & auton>=0, re



*Model 3 Fixed effects, no interactions
xtlogit cgovtarget  econ_issue c.GovtShareGDP pol_issue c.polity2 ethnic_issue c.discpop protest strike  CIRIPhysInteg log_pop log_gdp capital auton africa if etype<7 & auton>=0, fe
*Model 4 Fixed effects, with interactions
xtlogit cgovtarget  econ_issue##c.GovtShareGDP pol_issue##c.polity2 ethnic_issue##c.discpop protest strike  CIRIPhysInteg log_pop log_gdp capital auton africa if etype<7 & auton>=0, fe


*MARGINAL PLOTS BASED ON MODEL 2*

xtlogit cgovtarget  econ_issue##c.GovtShareGDP pol_issue##c.polity2 ethnic_issue##c.discpop protest strike  CIRIPhysInteg log_pop log_gdp capital auton africa if etype<7 & auton>=0, re
margins econ_issue, predict(pu0) at(GovtShareGDP = (0(5)60))
marginsplot, plot1opts(msymbol (O) lcolor(gs5) mcolor(gs5) ) plot2opts(msymbol(T) lcolor(red) mcolor(red)) ci1opts (acolor(gs5)) ci2opts (acolor(red))

xtlogit cgovtarget  econ_issue##c.GovtShareGDP pol_issue##c.polity2 ethnic_issue##c.discpop protest strike  CIRIPhysInteg log_pop log_gdp capital auton africa if etype<7 & auton>=0, re
margins pol_issue, predict(pu0) at(polity2 = (-10(1)10))
marginsplot, plot1opts(msymbol (O) lcolor(gs5) mcolor(gs5) ) plot2opts(msymbol(T) lcolor(red) mcolor(red)) ci1opts (acolor(gs5)) ci2opts (acolor(red))

xtlogit cgovtarget  econ_issue##c.GovtShareGDP pol_issue##c.polity2 ethnic_issue##c.discpop protest strike  CIRIPhysInteg log_pop log_gdp capital auton africa if etype<7 & auton>=0, re
margins ethnic_issue, predict(pu0) at(discpop = (0(.05)1))
marginsplot, plot1opts(msymbol (O) lcolor(gs5) mcolor(gs5) ) plot2opts(msymbol(T) lcolor(red) mcolor(red)) ci1opts (acolor(gs5)) ci2opts (acolor(red))


***MODELS FOR TABLE 2**
*Model 1, includes All event types*
xtlogit cgovtarget  econ_issue##c.GovtShareGDP pol_issue##c.polity2 ethnic_issue##c.discpop violent CIRIPhysInteg log_pop log_gdp capital auton africa if etype!=7 & auton>=0, re
*Model 2, only organized violent events*
xtlogit cgovtarget  econ_issue##c.GovtShareGDP pol_issue##c.polity2 ethnic_issue##c.discpop CIRIPhysInteg log_pop log_gdp capital auton africa if etype>7 & auton>=0, re
*Model 3, only non-violent events
xtlogit cgovtarget  econ_issue##c.GovtShareGDP pol_issue##c.polity2 ethnic_issue##c.discpop  CIRIPhysInteg log_pop log_gdp capital auton africa if violent == 0 & etype!=7 & auton>=0, re


***ROC PLOT***
*Model Comparison, Structural versus full*
*Country-level covariates only*
xtlogit cgovtarget GovtShareGDP polity2 discpop CIRIPhysInteg log_pop log_gdp  auton africa if etype<7 & auton>=0, re
predict country, xb

*Event issues only*
xtlogit cgovtarget  econ_issue pol_issue ethnic_issue   if etype<7 & auton>=0, re
predict demand, xb

*Full model*
xtlogit cgovtarget  econ_issue##c.GovtShareGDP pol_issue##c.polity2 ethnic_issue##c.discpop protest strike  CIRIPhysInteg log_pop log_gdp capital auton africa if etype<7 & auton>=0, re
predict full, xb

roccomp cgovtarget country demand full, graph plot1opts (msymbol(i)) plot2opts (msymbol(i))  plot3opts (msymbol(i) lcolor(black)) summary


**ROBUSTNESS CHECK**
*Model A1, Multilevel effects*
. xtmelogit cgovtarget  econ_issue##c.GovtShareGDP pol_issue##c.polity2 ethnic_issue##c.discpop protest strike  CIRIPhysInteg log_pop log_gdp capital auton africa || ccode: || year: if etype<7 & auton>=0
